package ru.ifmo.rybakov.muclumon.utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
import javax.persistence.Query;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ru.ifmo.rybakov.muclumon.Database;
import ru.ifmo.rybakov.muclumon.Properties;
import ru.ifmo.rybakov.muclumon.PropertyManager;
import ru.ifmo.rybakov.muclumon.PropertyValueFactory;
import ru.ifmo.rybakov.muclumon.Task;

public class SEMPParser {
private static final Logger logger = LoggerFactory.getLogger(ORCAParser.class); 
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if (args.length < 1) {
			logger.error("No arguments, run as <app> <file-path>. Terminating.");
			return;
		}
		String filePath = args[0];
		logger.info("SEMP parser syas 'hello'. Path: {}", filePath);

		// 54
		Map<Integer, String> fileName = new HashMap<Integer, String>();
		for (int i = 1675; i <= 1685; i++)  fileName.put(i, "GAMESS-54.out");
		for (int i = 1687; i <= 1690; i++)  fileName.put(i, "GAMESS-54.out");
		for (int i = 1693; i <= 1694; i++)  fileName.put(i, "GAMESS-54.out");
		for (int i = 1696; i <= 1697; i++)  fileName.put(i, "GAMESS-54.out");
		for (int i = 1700; i <= 1701; i++)  fileName.put(i, "GAMESS-54.out");
		for (int i = 1704; i <= 1707; i++)  fileName.put(i, "GAMESS-54.out");
		for (Entry<Integer, String> entry : fileName.entrySet()) {
			GAMESSParser.process(filePath + "/" + entry.getValue(), entry.getKey());
		}
		fileName.clear();
		
		//H2O
		fileName.put(1708, "H2O.out");
		fileName.put(1718, "H2O.out");
		// BF3
		fileName.put(1710, "BF3.out");
		fileName.put(1719, "BF3.out");
		// C6H6
		fileName.put(1711, "C6H6.out");
		fileName.put(1720, "C6H6.out");
		// C10H8
		fileName.put(1712, "C10H8.out");
		fileName.put(1723, "C10H8.out");
		// C18H12
		fileName.put(1713, "C18H12.out");
		fileName.put(1722, "C18H12.out");
		// C24
		fileName.put(1714, "C24.out");
		fileName.put(1726, "C24.out");
		fileName.put(1731, "C24.out");
		// C7O6H10
		fileName.put(1715, "C7O6H10.out");
		fileName.put(1728, "C7O6H10.out");
		fileName.put(1730, "C7O6H10.out");
		// C11O9H20
		fileName.put(1717, "C11O9H20.out");
		// C120
		fileName.put(1732, "C120.out");
		fileName.put(1734, "C120.out");
		// B137
		fileName.put(1727, "B137.out");
		fileName.put(1728, "B137.out");
		fileName.put(1729, "B137.out");
		
		// now look for files like orca.#.out under path
		for (Entry<Integer, String> entry : fileName.entrySet()) {
			ORCAParser.process(filePath + "/" + entry.getValue(), entry.getKey());
		}
	}
}
